use std::collections::HashMap;
use std::time::Instant;
use tungstenite::WebSocket;
use tungstenite::handshake::client::Response;
use tungstenite::protocol::CloseFrame;
use crate::summary::TestCaseSummary;

enum TransactionType {
    StartTime,
    EndTime,
}


struct CaseRunner {
    // hrp_runner: HRPRunner,
    // test_case: TestCase,
    // parser: Parser,
    // parsed_config: TConfig,
    // parameters_iterator: ParametersIterator,
    // root_dir: String,
    // ui_clients: HashMap<String, uixt::DriverExt>,
}

impl CaseRunner {
    // fn new(hrp_runner: HRPRunner, test_case: TestCase, parser: Parser, parsed_config: TConfig, parameters_iterator: ParametersIterator, root_dir: String) -> Self {
    //     CaseRunner {
    //         hrp_runner,
    //         test_case,
    //         parser,
    //         parsed_config,
    //         parameters_iterator,
    //         root_dir,
    //         ui_clients: HashMap::new(),
    //     }
    // }
}


pub struct SessionRunner {
    case_runner: CaseRunner,
    session_variables: HashMap<String, Box<dyn std::any::Any>>,
    transactions: HashMap<String, HashMap<TransactionType, Instant>>,
    start_time: Instant,
    summary: TestCaseSummary,
    ws_conn_map: HashMap<String, WebSocket<Response>>,
    inherit_ws_conn_map: HashMap<String, WebSocket<Response>>,
    // pong_response_chan: UnboundedSender<String>,
    // close_response_chan: UnboundedSender<CloseResponseObject>,
}

impl SessionRunner {
    fn new(case_runner: CaseRunner) -> Self {
        SessionRunner {
            case_runner,
            session_variables: HashMap::new(),
            transactions: HashMap::new(),
            start_time: Instant::now(),
            summary: TestCaseSummary::new(),
            ws_conn_map: HashMap::new(),
            inherit_ws_conn_map: HashMap::new(),
            // pong_response_chan: unbounded(),
            // close_response_chan: unbounded(),
        }
    }
}